<?php
namespace app\admin\controller;
use think\Controller;
use think\Request;
use think\Session;

// 公共控制器
class Common extends Controller
{
    public function _initialize()
    {
        $loginInfo=session('name');

        if(empty($loginInfo)){
            //BatteryIndex
            $controller = Request::instance()->controller();


            if(false ===strpos($controller,'Battery'))
            {
                if(false === strpos($controller,'Pc') && false === strpos($controller,'News')){
                    $this->redirect('/login/index');
                }else{
                    $this->redirect('/pc_login/index');
                }

            }else{
                $this->redirect('/battery_login/index');
            }

        }
    }
}
